
var _FO = new(function() {
	this.putV = function(targetid, obj) {
		tag = document.getElementById(targetid)
		if(tag == null)
			return;
		if(tag.tagName == "INPUT" || tag.tagName == "TEXTAREA") {
			tag.value = obj;
		} else if(tag.tagName == "DIV" || tag.tagName == "SPAN") {
			tag.innerHTML = obj;
		}
	}
	//只对数值有用
	this.getN = function(targetid, def) {
		var o = this.getV(targetid);
		var i = Number(o);
		if(isNaN(i)) {
			if(isNaN(def)) {
				return 0;
			} else {
				return def;
			}
		}
		return i;
	}
	this.getV = function(targetid) {
		tag = document.getElementById(targetid);
		if(tag == null)
			return null;
		var obj = '';
		if(tag.tagName == "INPUT" || tag.tagName == "TEXTAREA") {
			obj = tag.value
		} else if(tag.tagName == "DIV") {
			obj = tag.innerHTML
		}

		return obj;
	}
	this.ToM = function(value, arr, kv) {
		if(!_IS.isArray(arr)) return null;
		var fis = ['text', 'value']
		if(kv) {
			fis = kv.split(',')
		}
		for(var i = 0; i < arr.length; i++) {
			if(arr[i].value == value) {
				var obj = {}
				obj.text = arr[i][fis[0]]
				obj.value = arr[i][fis[1]]
				return obj;
			}
		}
	}
	this.putM = function(targetid, obj) {
		//console.log(JSON.stringify(obj))
		tag = document.getElementById(targetid)
		if(tag == null)
			return;
		if(obj == null)
			obj = {
				text: null,
				value: null
			};
		if(tag.tagName == "INPUT" || tag.tagName == "TEXTAREA") {
			tag.value = obj.text;
		} else if(tag.tagName == "DIV") {
			tag.innerHTML = obj.text;
		}
		tag.extenddata = obj.value
	}
	this.getM = function(targetid) {
		var obj = {
			text: null,
			value: null
		};
		tag = document.getElementById(targetid);
		if(tag == null)
			return obj;
		if(tag.tagName == "INPUT" || tag.tagName == "TEXTAREA") {
			obj.text = tag.value
		} else if(tag.tagName == "DIV") {
			obj.text = tag.innerHTML
		}
		obj.value = tag.extenddata
		return obj;
	}
})();